package com.faiz.algorithm;

public class ListNodeBuilder {
    private final ListNode head;
    private ListNode tail;

    public ListNodeBuilder(ListNode node) {
        head = node;
        tail = node;
    }


    public ListNodeBuilder add(int val) {
        tail.next = new ListNode(val);
        tail = tail.next;
        return this;
    }

    public ListNode getHead() {
        return head;
    }
}
